package com.fengwan.wastesort.ui.viewModel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel;
import com.fengwan.wastesort.model.Waste
import com.fengwan.wastesort.ui.viewModel.WasteDbViewModel
import org.jetbrains.anko.db.classParser
import org.jetbrains.anko.db.select

class WasteWetViewModel(app: Application) : WasteDbViewModel(app) {
    val wetWastes = MutableLiveData<List<Waste>>()

    fun loadWetWastes(_id: Int = 0, type: Int = 3) {
        wetWastes.value = database.select(tabName, "_id", "name","type")
            .whereArgs("(_id > $_id) and (type = $type)")
            .limit(50)
            .parseList(classParser<Waste>())
    }
}
